package chtp02;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main5 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<String> list = new ArrayList<String>();
		String ch=sc.next();
		int i=0;
		while(!ch.contains("!!end!!")) {
			 list.add(ch);
			 ch=sc.next();
			 i++;
		}
		list.add(0, "begin");
		list.add(i+1, "end");
		System.out.println(list);
		
	}
	
}
